import { formatMessage } from 'umi-plugin-locale';
import routes from './router'
const moment = require('moment');

const { VISUAL_API, KD3000_URL, GROUP, MAP, MAP_API_HOST, MAP_TILES_HOST, MAP_SECRET_KEY } = process.env;

const plugins = [
  // ref: https://umijs.org/plugin/umi-plugin-react.html
  ['umi-plugin-react', {
    antd: true,
    dva: {
      immer: true
    },
    dynamicImport: {
      loadingComponent: './components/PageLoading/index',
      webpackChunkName: true,
      level: 3,
    },
    title: {
      useLocale: true,
      defaultTitle: 'KD3000',
      format: '{parent}{separator}{current}'
    },
    dll: true,
    locale: {
      enable: true,
      default: 'zh-CN',
      // default: 'en-US',
      baseNavigator: true,
    },
    routes: {
      exclude: [
        /models\//,
        /services\//,
        /model\.(t|j)sx?$/,
        /service\.(t|j)sx?$/,
        /components\//,
      ],
    },
  }],
]
// ref: https://umijs.org/config/
export default {
  hash: true,
  treeShaking: true,
  routes: routes,
  plugins: plugins,
  define: {
    'VISUAL_API': VISUAL_API || 'http://127.0.0.1:81',
    'KD3000_URL': KD3000_URL || 'http://183.233.209.30:83/',
    'DES_KEY': '7e96c6045551061d3e1ee76c802d2b45',
    APP_TITLE: '康盾可视化指挥调度系统',
    GROUP: GROUP,
    MAP: MAP || "baidu_online",
    MAP_API_HOST: MAP_API_HOST || 'http://172.21.4.248:20080',
    MAP_TILES_HOST: MAP_TILES_HOST || 'http://172.21.4.248:20080',
    MAP_SECRET_KEY: MAP_SECRET_KEY || '',
    KD3300_VERSION: '1.0',
    BUILD_TIME: moment().format("YYYYMMDDHHmm")
  }
}
